package com.itqf.Service.Note.impl;

import com.itqf.Dao.NoteMapper;
import com.itqf.Service.Note.NoteService;
import com.itqf.entity.Note;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class NoteServiceImpl implements NoteService {
    @Resource
    private NoteMapper noteMapper;

    @Override
    public int addnote(String userid,String notetitle,String notecontent) {

        Map map = new HashMap();
        map.put("notetitle",notetitle);
        map.put("userid",userid);
        map.put("notecontent",notecontent);
       // map.put("usernoteid",note.getUsernoteid());
        int i = noteMapper.addnote(map);
        return i;
    }

    @Override
    public List<Note> findbyuserid(String userid) {

        return noteMapper.findbyuserid(userid);
    }


    @Override
    public Note findbyusernoteid(String usernoteid) {

        return noteMapper.findbyusernoteid(usernoteid);
    }

    @Override
    public int updatenote(String notetitle,String notecontent,Integer usernoteid) {
        Map map = new HashMap();
        map.put("notetitle",notetitle);
        map.put("notecontent",notecontent);
        map.put("usernoteid",usernoteid);
        return noteMapper.updatenote(map);
    }

    @Override
    public int delect(int usernoteid) {
        return noteMapper.delect(usernoteid);
    }
}
